import type {App} from "vue";
import {useAuthStore} from "@/stores";

const setupPermissionCommand = (app: App) => {
    const authStore = useAuthStore();
    app.directive('p', {
        mounted(el, binding) {
            if (!authStore.hasPermission(binding.value)) {
                el.parentNode && el.parentNode.removeChild(el);
            }
        }
    })
}

export default setupPermissionCommand;
